package de.tum.in.far.threedui.general;

import java.util.Vector;

import javax.media.j3d.Transform3D;

import ubitrack.SimplePose;

public class ObservablePoseReceiver extends PoseReceiver {
	Vector<PoseListener> listeners;
	String message;

	public ObservablePoseReceiver(String message) {
		this.listeners = new Vector<>();
		this.message= message;
	}

	@Override
	public void receivePose(SimplePose pose) {
		super.receivePose(pose);
		
		Transform3D t3d = getTransform3D();
		for(PoseListener pl : this.listeners)
		{
			pl.onPoseReceived(message, t3d);
		}
	}
	
	public Transform3D getTransform3D()
	{
		Transform3D t3d = new Transform3D();
		this.markerTransGroup.getTransform(t3d);
		return t3d;
	}
	
	public void addPoseListener(PoseListener pl)
	{
		this.listeners.add(pl);
	}
}